package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.dto.LearningPlanDTO;
import com.tianji.learning.domain.vo.LearningLessonVO;
import com.tianji.learning.domain.vo.LearningPlanPageVO;
import com.tianji.learning.service.ILearningLessonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 学生课程表 前端控制器
 * </p>
 *
 * @author 大扒鸭
 * @since 2025-06-27
 */
@Api(tags = "学生课程表接口")
@RestController
@RequestMapping("/lessons")
public class LearningLessonController {
    @Autowired
    private ILearningLessonService lessonService;

    @ApiOperation("查询我的课程表")
    @GetMapping("page")
    public PageDTO<LearningLessonVO> queryMyLessons(PageQuery pageQuery) {
        return lessonService.queryMyLessons(pageQuery);
    }

    @ApiOperation("查询正在学习的课程表")
    @GetMapping("now")
    public LearningLessonVO queryNowLearningLesson() {
        return lessonService.queryNowLearningLesson();
    }
    @ApiOperation("创建学习计划")
    @PostMapping("lessons")
    public void createLearningPlan(@RequestBody LearningPlanDTO formDTO){
        lessonService.createLearningPlan(formDTO);
    }

    @ApiOperation("统计查询我的学习计划")
    @GetMapping("plans")
    public LearningPlanPageVO queryMyPlans(PageQuery pageQuery){
        return lessonService.queryMyPlans(pageQuery);
    }
}
